from pprint import pprint

gid = 1

class testPlugin:
    def __init__(self):
        #self.example = "This can initialize a class"
        pass

    def activate(self, plugin_api):
        #print "the plugin is initialized"
        pass

    def onTaskOpened(self, plugin_api):
        #print "a task was opened"
        pass

    def onTaskClosed(self, plugin_api):
        print "a task was closed"
        task = plugin_api.task
        attrs = task.attributes
        
        #d = dict()
        #for k,v in tast.__dict__.items():
        #    d[k] = v
        #pprint(d)
        
        #pprint(dict([(k,v) for k,v in task.__dict__.items()]))
        
        global gid
        if not ('ns','gid') in attrs:
            attrs[('ns','gid')] = str(gid)
        gid += 1
        
        pprint({k:v for k,v in task.__dict__.items()})

    def deactivate(self, plugin_api):
        #print "the plugin was deactivated"
        pass
